package com.cloud.client.service;

import com.cloud.client.service.fallback.AuthFallback;
import com.cloud.client.service.fallback.JobFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @packageName: com.cloud.client.service
 * @name: JobService
 * @description:
 * @author: 董定卓
 * @dateTime: 2019/7/17 9:14
 */
@FeignClient(name = "service-gateway-job", path = "/service-job", url = "${gateway.url}", fallback = JobFallback.class)
public interface JobService {

    /**
     * 添加任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/add")
    Object jobAdd(@RequestParam Map<String, Object> map);

    /**
     * 取消任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/pause")
    Object jobPause(@RequestParam Map<String, Object> map);

    /**
     * 恢复任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/resume")
    Object jobResume(@RequestParam Map<String, Object> map);

    /**
     * 更新任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/update")
    Object jobUpdate(@RequestParam Map<String, Object> map);

    /**
     * 删除任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/del")
    Object jobDel(@RequestParam Map<String, Object> map);

    /**
     * 启动所有任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/startAll")
    Object jobStartAll(@RequestParam Map<String, Object> map);

    /**
     * 结束所有任务
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/shutdownAll")
    Object jobShutdownAll(@RequestParam Map<String, Object> map);

    /**
     * 任务分页列表
     *
     * @param map
     * @return
     */
    @PostMapping(value = "/job/page")
    Object jobPage(@RequestParam Map<String, Object> map);
}
